import json
import config


# 封装读取JSON测试数据的方法

def read_json(filename, apiname):
    file_path = config.BASE_PATH + "/data/" + filename + ".json"
    with open(file_path, encoding="utf-8") as f:
        data = json.load(f)
    api_data = data.get(apiname)
    print(api_data)
    data_list = []
    for i in api_data:
        data_list.append(tuple(i.values()))
    print("最终获得的测试数据{}".format(data_list))
    return data_list


if __name__ == '__main__':
    a = read_json("reg_login_data", "img_verify_code")
    print(a)


